package cn.dengta.webapp.trade.entity.meta;

import cn.dengta.webapp.trade.entity.meta.MetaConfig.MetaRuleConfig;
import lombok.Getter;
import lombok.Setter;
import me.codeplayer.util.Assert;

/**
 * 额外展示推荐的规则配置对象
 */
@Getter
@Setter
public class RecommendGreetUpRule implements MetaRuleConfig {

	/** 搭讪倍数 */
	protected Integer multiple;
	/** 花费钻石 */
	protected Integer coin;
	/** 增加时长 */
	protected Integer perTime;
	/** 开启摘要 */
	protected String openSummary;
	/** VIP可免费提升曝光率的次数 */
	protected int vipFreeTimes;

	@Override
	public void validate() {
		Assert.isTrue(multiple != null, "搭讪倍数不能为空！");
		Assert.isTrue(coin != null, "花费钻石不能为空！");
		Assert.isTrue(perTime != null, "增加时长不能为空！");
		Assert.isTrue(vipFreeTimes >= 0, "VIP免费次数不能为空！");
	}

	@Override
	public void init(MetaRuleConfig config) {
		RecommendGreetUpRule pointConfig = (RecommendGreetUpRule) config;
		this.multiple = pointConfig.multiple;
		this.coin = pointConfig.coin;
		this.perTime = pointConfig.perTime;
		this.openSummary = pointConfig.openSummary;
		this.vipFreeTimes = pointConfig.vipFreeTimes;
	}

}
